<div class="checkout_wrapper">
    <? if(isset($items)) : ?>
        <div class="cart_header">
            <span class="shopping_cart_text">Review your order</span>
        </div>
        <div class="cart_fields">
            <span class="field_image">Item</span>
            <span class="field_description">Description</span>
            <span class="field_quantity">Quantity</span>
            <span class="field_price">Price</span>
            <span class="field_subtotal">Total Price</span>
            <div class="clear"></div>
        </div>

        <div class="cart_items_wrapper" style="min-height: 340px;height: auto;">
            <? $total = 0;
            foreach ($items as $item):
                    $total = $total + $item['price']*$item['quantity'];
                    $subtotal = $item['price']*$item['quantity'];
                    $image = Model::factory('directory')->getItemImages($item['id'], 'shop', $order = 'name', $orderDir = 'ASC');
                    $image = array_shift($image);
                    $img_url_preview = Model::factory('directory')->imagePath($image, 'cartItemPreview', $extension = 'jpg');
                    ?>

                    <div class="cart_item" data-id="<?=$item['id']?>">
                        <div class="cart_item_image">
                            <img src="<?=$img_url_preview?>"/>
                        </div>

                        <div class="cart_item_description">
                            <h3><?=$item['name']?></h3>
                            <div><?=$item['text']?></div>
                        </div>
                        <div class="cart_item_quantity">
                            <?=$item['quantity']?>
                        </div>
                        <div class="cart_item_price">$ <?=$item['price']?></div>
                        <div class="cart_item_subtotal">$ <?=$subtotal?></div>
                        <div class="cart_item_remove">
                            <a href="/commerce/deleteItem/<?=$item['section']?>/<?=$item['id']?>/" class="cart_item_remove_btn"></a>
                        </div>
                        <div class="clear"></div>

                        <div class="clear"></div>
                    </div>
            <? endforeach;?>
        </div>
        <div class="cart_footer">
            <div class="cart_footer_left">
                <a class="back_to_shop" href="/shop/">← Back to Shop Online</a>
            </div>

            <div class="cart_total">
                TOTAL: <span>$ <?=$total?></span>
            </div>
            <div class="cart_stripe"></div>
        </div>
        <div class="proceed_checkout_wrapper">

            <div class="checkout_payment">

                <h3>Please, select payment method:</h3>
                <form name="payment" method="POST">
                    <input type="hidden" name="payment[delivery]" id="customer-delivery" value="0" />
                    <input type="radio" value="creditcard" id="creditcard" name="payment[method]" checked="checked" />
                        <label for="creditcard">
                         <img src="/images/icons/payment/visa.png" width="50" height="30" alt="" class="middle" />
                         <img src="/images/icons/payment/mastercard.png" width="50" height="30" alt="" class="middle" />
                         <img src="/images/icons/payment/americanexpress.png" width="50" height="30" alt="" class="middle" />
                         <img src="/images/icons/payment/discover.png" width="50" height="30" alt="" class="middle" />
                        </label>
                    <br /><br />
                    <input type="radio" value="paypal" id="paypal" name="payment[method]" />
                        <label for="paypal">
                         <img src="/images/icons/payment/paypal.png" width="50" height="30" alt="" class="middle" />
                        </label>
                    <br /><br />
                    <input class="chk_submit_btn" type="submit" value="CONTINUE" />
                </form>

            </div>

            <div class="cart_bottom">

            </div>

        </div>


    <? else: ?>
    <div class="cart_header">
        <span class="shopping_cart_text">Your shopping cart is empty</span>


    </div>
    <div class="cart_items_wrapper">
        <a href='/shop/'>&larr; Back to Shop</a>
    </div>

    <? endif; ?>






</div>
 